home *** CD-ROM | disk | FTP | other *** search
- <?xml version="1.0" encoding="utf-8"?>
- <!-- ===========================================================
- Category: MultipleDataSources
- Sub-category:
- Author: David Silverlight
- HeadGeek@xmlpitstop.com
- Created: 2001-05-16
- Description:-
- This stylsheet demonstrates how to combine multiple XML
- documents into a single data source. In this example, the
- document names are stored as an attribute value. The
- stylesheet that combines the data first accesses each XML
- Document name using the document() function (demonstrating
- also how an xPath query can be applied to the document) and
- displays each document as HTML using the DisplayProds
- template.
- Note: This example was originally inspired by Kurt Cagle
- (http://www.KurtCagle.net).
- ================================================================ -->
- <xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:msxsl="urn:schemas-microsoft-com:xslt" ><xsl:output method="html"/>
-
- <xsl:include href="DisplayProds.xsl"/>
- <xsl:template match="/">
-
- <!--Create a variable which holds the names of the xml documents we are combining -->
- <xsl:variable name="doc.refs.1">
- <xsl:for-each select="ProductFiles/file">
- <doc><xsl:value-of select="@href"/></doc>
- </xsl:for-each>
- </xsl:variable>
-
-
- <!-- Iterate through the variable and display access xml document using the document() object.
- Note: We are using the MSXML implementation of the node-set function to access the contents as a nodeset. -->
-
- <xsl:for-each select="msxsl:node-set($doc.refs.1)//doc" >
- <!-- Display product information using our DisplayProducts.xsl template -->
- <xsl:call-template name="DisplayProds" >
- <xsl:with-param name="ProductNodes" select="document(.)"/>
- </xsl:call-template>
- </xsl:for-each>
-
-
-
- </xsl:template>
-
-
-
- </xsl:stylesheet>